Conversation
ExtraGravity
left a comment
There was a problem hiding this comment.
Just that change then I think we can merge it!
STM32Resources/install.sh
Outdated
| echo "export PATH=\$PATH:/opt/stlink/build" >> ~/.profile | ||
| export PATH=$PATH:/opt/stlink/build | ||
| if [ "$(. /etc/os-release; echo $NAME)" = "Ubuntu" ]; then | ||
| echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/opt/stlink/build" >> ~/.profile |
There was a problem hiding this comment.
For all these if else statements, it could be simplified by just setting a variable for the bash_profile file.
if Ubuntu, then
BASH_PROFILE="~/.profile
elseif Fedora, then
BASH_PROFILE=~/.bash_rc
fi
Something like that. Then just reference that variable for all your other calls.
STM32Resources/install.sh
Outdated
|
|
||
| apt-get -y install build-essential git libsane:i386 ia32-libs-multiarch autoconf libusb-1.0-0-dev lib32ncurses5 libncurses5:i386 software-properties-common pkg-config cmake | ||
| # Determine what distribution of Linux the user has | ||
| DISTRO = $(. /etc/os-release; echo $NAME) |
There was a problem hiding this comment.
Does this work? I think bash script variables can't have spaces around the equal sign. Regardless, that's the norm so it should be written that way :)
There was a problem hiding this comment.
Whoops, I pushed the wrong file haha. I'll update the if statements and push again.
STM32Resources/install.sh
Outdated
| chmod +x /usr/local/bin/CubeMX2Makefile | ||
| echo "export PATH=\$PATH:/opt/CubeMX2Makefile" >> ~/.profile | ||
| if [ "$DISTRO" = "Ubuntu" ]; then | ||
| BASH_PROFILE = "~./profile" |
There was a problem hiding this comment.
Just set this once at the top of the file and keep reusing it. No need for the same if statements.
| echo "export PATH=\$PATH:/opt/stlink/build" >> ~/.profile | ||
| echo "export PATH=\$PATH:/opt/stlink/build" >> $BASH_PROFILE | ||
| export PATH=$PATH:/opt/stlink/build | ||
| cp ~/.bashrc /root/ |
There was a problem hiding this comment.
This needs to use the $BASH_PROFILE var.
| DISTRO = $(. /etc/os-release; echo $NAME) | ||
|
|
||
| # Install files according to Linux distribution that the user has | ||
| if [ "$DISTRO" = "Ubuntu" ]; then |
There was a problem hiding this comment.
These if statements are a good place to set the BASH_PROFILE var.
Improved PR